VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsCancelDirective"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Public Function CancelDirective(ByVal sUserName As String, ByVal nDirectiveNumber As String) As recordSet

Dim adoConn As ADODB.Connection
Dim adoRSDirCancel As ADODB.recordSet
Dim adoComm As ADODB.Command






Set adoConn = New ADODB.Connection
With adoConn
    .CursorLocation = adUseClient
    .ConnectionString = GetConnectionString() 'Johann (20090625): Centralised code for connection string added
    .Open
End With

Set adoRSDirCancel = New ADODB.recordSet
With adoRSDirCancel
    .CursorLocation = adUseClient
    .CursorType = adOpenStatic
End With

Set adoComm = New ADODB.Command
With adoComm
    .CommandText = "dir_validate_cancel"
    .CommandType = adCmdStoredProc
    Set .ActiveConnection = adoConn
    .Parameters.Append .CreateParameter("username", adVarChar, adParamInput, 10, sUserName)
    .Parameters.Append .CreateParameter("directive_number", adVarChar, adParamInput, 15, nDirectiveNumber)
End With
    
Set adoRSDirCancel = adoComm.Execute

'Clean up
Set adoRSDirCancel.ActiveConnection = Nothing
adoConn.Close
Set CancelDirective = adoRSDirCancel
Set adoConn = Nothing
Set adoComm = Nothing


End Function 'CancelDirective()
Public Function GetDirectiveDetails(ByVal nDirectiveNumber As String) As recordSet

Dim adoConn As ADODB.Connection
Dim adoRSDirDetails As ADODB.recordSet
Dim adoComm As ADODB.Command






Set adoConn = New ADODB.Connection
With adoConn
    .CursorLocation = adUseClient
    .ConnectionString = GetConnectionString() 'Johann (20090625): Centralised code for connection string added
    .Open
End With


Set adoRSDirDetails = New ADODB.recordSet
With adoRSDirDetails
    .CursorLocation = adUseClient
    .CursorType = adOpenStatic
End With


Set adoComm = New ADODB.Command
With adoComm
    .CommandText = "dir_get_directive_details"
    .CommandType = adCmdStoredProc
    Set .ActiveConnection = adoConn
    .Parameters.Append .CreateParameter("directive_number", adInteger, adParamInput, , nDirectiveNumber)
End With
    
Set adoRSDirDetails = adoComm.Execute

'Clean up
Set adoRSDirDetails.ActiveConnection = Nothing
adoConn.Close
Set GetDirectiveDetails = adoRSDirDetails
Set adoConn = Nothing
Set adoComm = Nothing


End Function 'GetDirectiveDetails()
Public Function DirectiveCancelDone(ByVal nDirectiveNumber As String, _
                                    Optional ByVal sCancelReason As String = "")

Dim adoConn As ADODB.Connection
Dim adoRSCancelDone As ADODB.recordSet
Dim adoComm As ADODB.Command

Set adoConn = New ADODB.Connection
With adoConn
    .CursorLocation = adUseClient
    .ConnectionString = GetConnectionString() 'Johann (20090625): Centralised code for connection string added
    .Open
End With

Set adoComm = New ADODB.Command
With adoComm
    .CommandText = "dir_cancel_directive"
    .CommandType = adCmdStoredProc
    Set .ActiveConnection = adoConn
    .Parameters.Append .CreateParameter("directive_number", adInteger, adParamInput, , nDirectiveNumber)
    .Parameters.Append .CreateParameter("cancel_reason", adVarChar, adParamInput, 120, sCancelReason)
End With
    
adoComm.Execute

'Clean up
adoConn.Close
Set adoConn = Nothing
Set adoComm = Nothing


End Function 'DirectiveCancelDone()
